<!-- 

Owner is directed here when edit link is clicked.

Author: Ludvig Gee

-->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="Style.css">
<title>Hungry In Lindholmen - Find where you can eat what you want to eat</title>

<!-- 

Initialize variables which will be used later on the page. 

-->

	<%
		String input_1 = request.getParameter("input_1");
		String input_2 = request.getParameter("input_2");
		String input_3 = request.getParameter("input_3");
		String input_4 = request.getParameter("input_4");
		String input_5 = request.getParameter("input_5");
		String input_6 = request.getParameter("input_6");
		String input_7 = request.getParameter("input_7");
		request.getSession().setAttribute("optionEdit", request.getParameter("option"));
		request.getSession().setAttribute("dishAla", request.getParameter("input_1"));
		request.getSession().setAttribute("dishLunch", request.getParameter("input_2"));
		int option = Integer.parseInt(request.getParameter("option"));
		int editOption;
		%>


	<SCRIPT TYPE="text/javascript">

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=1610,height=730,scrollbars=yes,left=100,top=100,toolbar=yes,rezisable=yes');
return false;
}

</SCRIPT>

</head>
<body>


<div id="container">

	
	<div id="header">
		<img src="header3.png">
		<div id="owner">
			<a id="owner" href="Logout">Logout</a>
		</div>
	</div>
	
	<!-- The form wrapper class is the search text-box and button. -->
	
	<form class="form-wrapper" method="post" action="OwnerServlet">
			<input type="radio" name="radioButton" value="a" checked>
		a La Carte Menu
		<input type="radio" name="radioButton" value="b" >
		<b>User/Pass</b>
		<input type="radio" name="radioButton" value="c" >
		<b>Lunch Menu</b>
		<input type="radio" name="radioButton" value="d" >
		<b>Restaurant Info</b>
		<input type="radio" name="radioButton" value="e" >
		<b>Opening Hours</b>
			<INPUT TYPE="submit" VALUE="Show table"> 
	</form>
	
	 <div id="restaurantlist">
	 <b>Statistics</b>
		<ul>
			<li><A HREF="ChartServlet?type=a&restId=<%=request.getSession().getAttribute("restID") %>" onClick="return popup(this, 'chart')">Top 10 Dishes</A>
			<li><A HREF="ChartServlet?type=b&restId=<%=request.getSession().getAttribute("restID") %>" onClick="return popup(this, 'chart')">Top 10 Searches</A>
			<li><A HREF="ChartServlet?type=c&restId=<%=request.getSession().getAttribute("restID") %>" onClick="return popup(this, 'chart')">Top 10 Restaurants</A>
			<li><A HREF="ChartServlet?type=d&restId=<%=request.getSession().getAttribute("restID") %>" onClick="return popup(this, 'chart')">Top 10 Lunch Dishes</A>
		</ul>
	</div>
	
	<div id="searchresultpage">
<!-- 

The submit form using submit to send parameter to editServlet.

-->
	<form name="frm" method="get" action="editServlet">
	<table>
	<%
	
	if(option == 1){ 
		
	%>
	
	
		<tr>
			<th>Dish</th>
			<th>Description</th>
			<th>Price</th>
			<th>Type</th>			
			<th></th>	
			<th></th>
		</tr>
		
		<tr>
			<td><input type="text" name="edit_1" placeholder=<%=input_1%>></td>
			<td><input type="text" name="edit_2" maxlength="200" placeholder=<%=input_2%>></td>
			<td><input type="text" name="edit_3" size="3" maxlength="11" placeholder=<%=input_3%>></td>
			<td><input type="text" name="edit_4" size="6" maxlength="45" placeholder=<%=input_4%>></td>			
			<td><input type="submit" name="submit" value="Update"></td>	
			<td></td>
		</tr>
		
		
		<%} %>
		
<%
	
	if(option == 2){ 
		
	%>
	
	<!-- This part creates a table with searchresults unless the resultset is null.
		First: print the headers then enter the while loop and print information
		from the resultset. The string altClass is used to set the different styles
		for table cell background-colors.
	 -->
	
	
		<tr>
			<th>Owner</th>
			<th>UserName</th>
			<th>Password</th>
			<th></th>			
			
			<tr>
			<td><input type="text" name="edit_1" size="6" maxlength="30" placeholder=<%=input_1%>></td>
			<td><input type="text" name="edit_2" maxlength="20" placeholder=<%=input_2%>></td>
			<td><input type="text" name="edit_3" maxlength="10" placeholder=<%=input_3%>></td>	
			<td><input type="submit" name="submit" value="Update" placeholder=<%=input_4%>></td>
		</tr>
		
		<%} %>		
		
		<%
	
	if(option == 3){ 
		
	%>
	
	
		<tr>
			<th>Date</th>
			<th>Dish</th>
			<th>Description</th>
			<th>Price</th>	
			<th>Type</th>		
			<th></th>
			<th></th>	
			
		</tr>
		
		<tr>
			<td><input type="text" name="edit_1" size="6" placeholder=<%=input_1%>></td>
			<td><input type="text" name="edit_2" size="12" maxlength="100" placeholder=<%=input_2%>></td>
			<td><input type="text" name="edit_3" placeholder=<%=input_3%>></td>
			<td><input type="text" name="edit_4" maxlength="200" size="3" placeholder=<%=input_4%>></td>			
			<td><input type="text" name="edit_5" maxlength="100" size="6" placeholder=<%=input_5%>></td>	
			<td><input type="submit" name="submit" value="Update"></td>
		</tr>
		
		
		<%} %>
		
		<%
	
	if(option == 4){ 
		
	%>
	
	
	
	
		<tr>
			<th>Type</th>
			<th>Adress</th>
			<th>Description</th>
			<th>Phone_Nr</th>
			<th></th>			
				
			
		</tr>
		<tr>
			<td><input type="text" name="edit_1" maxlength="30" size="6"placeholder=<%=input_1%>></td>
			<td><input type="text" name="edit_2" maxlength="50" placeholder=<%=input_2%>></td>
			<td><input type="text" name="edit_3" maxlength="10"placeholder=<%=input_3%>></td>
			<td><input type="text" name="edit_4" size="6" placeholder=<%=input_4%>></td>	
			<td><input type="submit" name="submit" value="Update"></td>
		</tr>
		
		<%} %>
		
		<%
	
	if(option == 5){ 
		
	%>
	
	
		<tr>
			<th>Monday</th>
			<th>Tuesday</th>
			<th>Wednesday</th>
			<th>Thursday</th>	
			<th>Friday</th>
			<th>Saturday</th>
			<th>Sunday</th>			
			<th></th>
			</tr>
			
			<tr>
			<td><input type="text" name="edit_1" size="5" placeholder=<%=input_1%>></td>
			<td><input type="text" name="edit_2" size="5" placeholder=<%=input_2%>></td>
			<td><input type="text" name="edit_3" size="5" placeholder=<%=input_3%>></td>
			<td><input type="text" name="edit_4" size="5" placeholder=<%=input_4%>></td>			
			<td><input type="text" name="edit_5" size="5" placeholder=<%=input_5%>></td>
			<td><input type="text" name="edit_6" size="5" placeholder=<%=input_6%>></td>
			<td><input type="text" name="edit_7" size="5" placeholder=<%=input_7%>></td>	
			<td><input type="submit" name="submit" value="Update"></td>
		</tr>
			
		
		
		
		<%} %>
		
	</table>
	</form>
	</div>
	 
  <div id="firstpage">
  Type in any textfield what you would like to update!
  </div>

	<div id="footer">
		Hungry In Lindholmen created by Group 6 Saturn<br>
		For more information, questions or whatever send us an 
		<a href="mailto:olof.ekelund84@gmail.com?subject=HungryInLindholmen"> e-mail.</a>
	</div>

</div>
</body>
</html>